package com.yaolisheng.util.enums;

/**
 * @Company: 神州数码信息系统有限公司
 * @Author : yaols
 * @Date: 2022/10/08/21:02
 **/

import java.util.Objects;

/**
 * 消息类型（来源）
 */
public enum PromSqlHttpApiEnum {
    // 枚举实例
    UP("UP", "UP"),
    HTTP_REQUESTS_TOTAL("http_requests_total", "所有时间序列样本数据"),
//    cpu使用率
    CPU_USAGE("(1 - avg (irate(node_cpu_seconds_total{mode=\"idle\",instance=\"IP:9100\"}[5m])) by(instance))*100", "CPU使用率"),
//    内存使用率
    MEMORY_USAGE("((node_memory_MemTotal_bytes-(node_memory_MemFree_bytes+node_memory_Buffers_bytes+node_memory_Cached_bytes))/node_memory_MemTotal_bytes)*100","内存使用率");
    private String promSql;
    private String explain;

    PromSqlHttpApiEnum(String promSql, String explain) {
        this.promSql = promSql;
        this.explain = explain;
    }

    public static String getTypeName(String explain) {
        for (PromSqlHttpApiEnum m : PromSqlHttpApiEnum.values()) {
            if (Objects.equals(m.getPromSql(), explain)) {
                return m.explain;
            }
        }
        return "";
    }

    public String getPromSql() {
        return this.promSql;
    }

    public void setPromSql(String promSql) {
        this.promSql = promSql;
    }

    public String getExplain() {
        return this.explain;
    }

    public void setExplain(String explain) {
        this.explain = explain;
    }
}


